package bank.model.vo;

//package BankServer;

import java.util.ArrayList;

public class Employee extends Person 
{
	public Employee(int id, String firstName, String lastName, int department)
	{
		super(firstName,lastName);
		this.setId(id);
		this.setDepartment(department);
		payments = new ArrayList<Payment>();
		report = new Report(this);
	}
	
	
	public Employee(int id, String firstName, String lastName, String subName, int department, int login)
	{
		super(firstName,lastName,subName);
		this.setId(id);
		this.setDepartment(department);
		this.setLogin(login);
		payments = new ArrayList<Payment>();
		report = new Report(this);
	}
	
	
	public Employee(int id, String firstName, String lastName, int department, boolean boss)
	{
		super(firstName,lastName);
		this.setId(id);
		this.setDepartment(department);
		this.setBoss(boss);
		payments = new ArrayList<Payment>();
		report = new Report(this);
	}
	
	
	public Employee(int id, String firstName, String lastName, String subName,int department, boolean boss)
	{
		super(firstName,lastName,subName);
		this.setId(id);
		this.setDepartment(department);
		this.setBoss(boss);
		payments = new ArrayList<Payment>();
		report = new Report(this);
	}
	
	
	public Employee(String firstName, String lastName, int department)
	{
		super(firstName,lastName);
		this.setId(getNextId());
		this.setDepartment(department);
		payments = new ArrayList<Payment>();
		report = new Report(this);
	}
	
	
	public Employee(String firstName, String lastName, int department, boolean boss)
	{
		super(firstName,lastName);
		this.setId(getNextId());
		this.setDepartment(department);
		this.setBoss(boss);
		payments = new ArrayList<Payment>();
		report = new Report(this);
	}	
	
	
	public Employee(String firstName, String lastName, String subName,int department)
	{
		super(firstName,lastName,subName);
		this.setId(getNextId());
		this.setDepartment(department);
		payments = new ArrayList<Payment>();
		report = new Report(this);
	}
		
	
	public Employee(String firstName, String lastName, String subName,int department, boolean boss)
	{
		super(firstName,lastName,subName);
		this.setId(getNextId());
		this.setDepartment(department);
		this.setBoss(boss);
		payments = new ArrayList<Payment>();
		report = new Report(this);
	}

	/**
	 * 
	 * @return department
	 */	
	public int getDepartment() {
		return department;
	}
	/**
	 * set department
	 * @param department 
	 */
	public void setDepartment(int department) {
		this.department = department;
	}
	
	/**
	 * 
	 * @return
	 */
	public int getId(){
		return id;
	}
	/**
	 * increment Id
	 *@param Id
	 * 
	 */
	private void setId(int id){
		this.id = id;
		if (id >= nextId) 
			nextId = id+1;
	}
	/**
	 * 
	 * @return nextId
	 */
	public static int getNextId(){
		return nextId;
	}
	public static void setNextId(int id){
		if (id >= nextId)
		nextId = id;
		
	}
	public void setBoss(boolean boss){
		this.boss = boss;
	}
	public boolean isBoss() {
		return boss;
	}
	
	public void addPayment(Payment payment)
	{
		payments.add(payment);
	}
	
	public ArrayList<Payment> getPayments() {
		ArrayList<Payment> payments = new ArrayList<Payment>();
		for (Payment p: this.payments) {
			payments.add(p);
		}		
		return payments;
	}
	
	public int getLogin() {
		return login;
	}


	public void setLogin(int login) {
		this.login = login;
	}


	public void saveReport(String fileName) {
		report.saveToFile(fileName);
	}
	
	private int id;
	protected int department;
	protected int login;
	private static int nextId = 1;
	private boolean boss;
	private ArrayList<Payment> payments;
	private Report report;
}

